# - Config file for the FlameMan package
# It defines the following variables:

#  FlameMan_BIN_DIR                      - location of FlameMan
#  FlameMan_VERSION                      - version of the binary
#  FlameMan_ConfigPackageLocation        - location of the configuration files (= FlameMan_DIR)
# Imported Targets:
#  FlameMan_BINS                         - all executables
#  FlameMan::FlameMan                    - executable target

@PACKAGE_INIT@
set(cfg_hint "The problem is most likely that the generation of FlameManConfig.cmake in FlameMan/CMakeLists.txt is not up-to-date.")
set(FlameMan_VERSION "@FlameMan_VERSION@")
message("-- Found FlameMan, Version ${FlameMan_VERSION}")
if(@set_check@)
	set_and_check(FlameMan_BIN_DIR "@PACKAGE_INSTALL_BIN_DIR@")
	set_and_check(FlameMan_ConfigPackageLocation "@PACKAGE_ConfigPackageLocation@")
	if (NOT PACKAGE_PREFIX_DIR STREQUAL "")
		message("-- Using 'FlameMan' from '${PACKAGE_PREFIX_DIR}'")
	endif()
else()
	set(FlameMan_BIN_DIR "@FlameManDirectory@")
	# check when find_package is used whether directory exists
	if(NOT EXISTS "${FlameMan_BIN_DIR}")
		message(FATAL_ERROR "FlameMan_BIN_DIR not found: ${FlameMan_BIN_DIR}"
							" ${cfg_hint}")
	endif()
	set_and_check(FlameMan_ConfigPackageLocation "@PACKAGE_ConfigPackageLocation@")
	message("-- Using 'FlameMan' from a build tree")
	if (NOT FlameMan_BIN_DIR STREQUAL "")
		message("\t binary dir.:        '${FlameMan_BIN_DIR}'")
	endif()
	if (NOT FlameMasterLibs_ConfigPackageLocation STREQUAL "")
		message("\t target import:      '${FlameMan_ConfigPackageLocation}/FlameManTargets.cmake'")
	endif()
	if (NOT FlameMan_ConfigPackageLocation STREQUAL "")
		message("\t package location:   '${FlameMan_ConfigPackageLocation}'")
	endif()
endif()

include(${FlameMan_ConfigPackageLocation}/FlameManTargets.cmake)
# check whether configuration file is still up to date
set(FlameMan_BINS @FlameMannamespace@FlameMan )
foreach(t ${FlameMan_BINS})
	if(NOT TARGET ${t})
		message(FATAL_ERROR "Expected target does not exist: '${t}'\n"
			" Note that targets are case sensitive."
			" ${cfg_hint}")
	endif()
endforeach()